<?php
    $a = R::findOne( 'gactivity', 'user_id = ? AND group_id = ? ORDER BY id DESC', [$user->id, $group->id]);
    $a->dateTo = R::isoDateTime();
    $a = R::store( $a );

    unset( $group->sharedUserList[$u_id] ); //remove from active
    $group->nonActiveUsers = deactivetUserGroup($u_id, $group); //add to non active
    $g = R::store($group);

    if(isset($a) && isset($g)){
        $result["success"] = 'true';
        $result["message"] = 'Successfully deactivated user';
        echo json_encode($result);
        die();
    }
